- user = spam_log.user
%tr
  %td{ data: { label: _('Date') } }
    %div{ class: "@md/panel:gl-whitespace-nowrap" }= time_ago_with_tooltip(spam_log.created_at)
  %td{ data: { label: _('User') } }
    %div
      - if user
        .gl-mb-3= link_to user.name, [:admin, user]
        .gl-text-sm
          = sprite_icon('clock', css_class: "gl-mr-1 gl-fill-icon-subtle gl-icon", size: 12)
          = _('Joined %{user_created_time}').html_safe % { user_created_time: time_ago_with_tooltip(user.created_at) }
      - else
        = _('(removed)')
      .gl-text-sm
        = sprite_icon('earth', css_class: "gl-mr-1 gl-fill-icon-subtle gl-icon", size: 12)
        = _('Source IP:')
        = spam_log.source_ip
      .gl-mt-2{ class: "@md/panel:gl-whitespace-nowrap" }
        = render Pajamas::BadgeComponent.new(moderation_status(user), variant: :neutral)
        - if spam_log.via_api?
          = render Pajamas::BadgeComponent.new(_('API'), variant: :neutral)
        - if spam_log.recaptcha_verified?
          = render Pajamas::BadgeComponent.new(_('Recaptcha verified'), variant: :neutral)
  %td{ data: { label: _('Type') } }
    = spam_log.noteable_type
  %td{ data: { label: _('Details') } }
    %div
      .gl-text-bold= spam_log.title
      .gl-mt-3= truncate(spam_log.description, length: 200)
  %td{ data: { label: _('Actions') } }
    .dropdown
      = render Pajamas::ButtonComponent.new(icon: 'ellipsis_v', category: :tertiary, button_options: { 'aria-label': 'More actions', data: { title: 'More actions', toggle: 'dropdown', container: 'body' }})
      %ul.dropdown-menu.dropdown-menu-sort.dropdown-menu-right
        -# TODO: Remove conditonal once spamcheck supports this https://gitlab.com/gitlab-com/gl-security/engineering-and-research/automation-team/spam/spamcheck/-/issues/190
        - if akismet_enabled?
          %li
            - if spam_log.submitted_as_ham?
              = render Pajamas::ButtonComponent.new(category: :tertiary,
                button_options: { class: 'disabled menu-item'}) do
                = _("Submitted as ham")
            - else
              = render Pajamas::ButtonComponent.new(category: :tertiary,
                method: :post,
                href: mark_as_ham_admin_spam_log_path(spam_log),
                button_options: { class: 'menu-item' }) do
                = _('Submit as ham')
        - if user && !user.blocked?
          %li
            = render Pajamas::ButtonComponent.new(category: :tertiary,
              method: :put,
              href: block_admin_user_path(user),
              button_options: { class: 'menu-item', data: {confirm: _('User will be blocked! Are you sure?')} }) do
              = _('Block user')
        - else
          %li
            = render Pajamas::ButtonComponent.new(category: :tertiary,
              button_options: { class: 'disabled menu-item'}) do
              = _("Already blocked")
        - if user && !user.trusted?
          %li
            = render Pajamas::ButtonComponent.new(category: :tertiary,
              method: :put,
              href: trust_admin_user_path(user),
              button_options: { class: 'menu-item', data: {confirm: _('User will be allowed to create possible spam! Are you sure?')} }) do
              = _('Trust user')
        - else
          %li
            = render Pajamas::ButtonComponent.new(category: :tertiary,
              method: :put,
              href: untrust_admin_user_path(user),
              button_options: { class: 'menu-item', data: {confirm: _('User will not be allowed to create possible spam! Are you sure?')} }) do
              = _('Untrust user')
        %li
          = render Pajamas::ButtonComponent.new(category: :tertiary,
            method: :delete,
            href: [:admin, spam_log],
            button_options: { class: 'menu-item js-remove-tr', remote: true, }) do
            = _('Remove log')
        - if user
          %li
            = render Pajamas::ButtonComponent.new(category: :tertiary,
              variant: :danger,
              method: :delete,
              href: admin_spam_log_path(spam_log, remove_user: true),
              button_options: { class: 'menu-item focus:!gl-bg-strong', data: { confirm: _("User %{user_name} will be removed! Are you sure?") % { user_name: user.name }, confirm_btn_variant: 'danger' } }) do
              %span.gl-text-danger= _('Remove user')
